<template>
  <div>
    <input type="text" v-model="friend.name">
  </div>
</template>

<script>
export default {
    data(){
        return{
            friend:{
                name:''
            }
        }
    },
    watch:{
        friend:{
            handler(newfriend,oldfriend){
                // console.log("newfriend："+newfriend);
                // console.log("oldfriend："+oldfriend);
                console.log(newfriend.name);
                console.log(oldfriend.name);
            },
            deep:true,
            immediate:false
        }
    }
}
</script>

<style>

</style>